# coding: utf-8
from PIL import Image
import math
import sys
def getAbilityRatio(imagePath):
    """
    获得能力点
    imagePath:图像路径
    return：能力点比率元组(顺时针旋转)
    """
    image=Image.open(imagePath)#打开图片
    w,h=image.size  #获取图片尺寸
    centerPoint=(w/2,146.0)  # 中心点位置测量值
    R=145  #测量值
    X=(2*math.pi)/7  #均分角度
    abilityPoint={'击杀':(centerPoint[0],centerPoint[1]),
                  '生存':(centerPoint[0],centerPoint[1]),
                  '助攻':(centerPoint[0],centerPoint[1]),
                  '物理':(centerPoint[0],centerPoint[1]),
                  '魔法':(centerPoint[0],centerPoint[1]),
                  '防御':(centerPoint[0],centerPoint[1]),
                  '金钱':(centerPoint[0],centerPoint[1]),
                 }
    redcolor=(238,96,73)#红色rgb(238, 96, 73)
    while R>0:
        line0=image.getpixel((centerPoint[0],centerPoint[1]-R))
        line1=image.getpixel((R*math.sin(X)+centerPoint[0],centerPoint[1]-R*math.cos(X)))
        line2=image.getpixel((R*math.sin(2*X)+centerPoint[0],centerPoint[1]-R*math.cos(2*X)))
        line3=image.getpixel((R*math.sin(3*X)+centerPoint[0],centerPoint[1]-R*math.cos(3*X)))
        line4=image.getpixel((R*math.sin(4*X)+centerPoint[0],centerPoint[1]-R*math.cos(4*X)))
        line5=image.getpixel((R*math.sin(5*X)+centerPoint[0],centerPoint[1]-R*math.cos(5*X)))
        line6=image.getpixel((R*math.sin(-X)+centerPoint[0],centerPoint[1]-R*math.cos(-X)))
        if line0==redcolor:
            abilityPoint['击杀']=(centerPoint[0],centerPoint[1]-R)
        if line1==redcolor:
            abilityPoint['生存']=(R*math.sin(X)+centerPoint[0],centerPoint[1]-R*math.cos(X))
        if line2==redcolor:
            abilityPoint['助攻']=(R*math.sin(2*X)+centerPoint[0],centerPoint[1]-R*math.cos(2*X))
        if line3==redcolor:
            abilityPoint['物理']=(R*math.sin(3*X)+centerPoint[0],centerPoint[1]-R*math.cos(3*X))
        if line4==redcolor:
            abilityPoint['魔法']=(R*math.sin(4*X)+centerPoint[0],centerPoint[1]-R*math.cos(4*X))
        if line5==redcolor:
            abilityPoint['防御']=(R*math.sin(5*X)+centerPoint[0],centerPoint[1]-R*math.cos(5*X))
        if line6==redcolor:
            abilityPoint['金钱']=(R*math.sin(-X)+centerPoint[0],centerPoint[1]-R*math.cos(-X))
        R=R-1
    R=145  #重新赋值计算
    击杀=pow(pow(abilityPoint['击杀'][0]-centerPoint[0],2)+pow(abilityPoint['击杀'][1]-centerPoint[1],2),0.5)/R
    生存=pow(pow(abilityPoint['生存'][0]-centerPoint[0],2)+pow(abilityPoint['生存'][1]-centerPoint[1],2),0.5)/R
    助攻=pow(pow(abilityPoint['助攻'][0]-centerPoint[0],2)+pow(abilityPoint['助攻'][1]-centerPoint[1],2),0.5)/R
    物理=pow(pow(abilityPoint['物理'][0]-centerPoint[0],2)+pow(abilityPoint['物理'][1]-centerPoint[1],2),0.5)/R
    魔法=pow(pow(abilityPoint['魔法'][0]-centerPoint[0],2)+pow(abilityPoint['魔法'][1]-centerPoint[1],2),0.5)/R
    防御=pow(pow(abilityPoint['防御'][0]-centerPoint[0],2)+pow(abilityPoint['防御'][1]-centerPoint[1],2),0.5)/R
    金钱=pow(pow(abilityPoint['金钱'][0]-centerPoint[0],2)+pow(abilityPoint['金钱'][1]-centerPoint[1],2),0.5)/R
    print (击杀,生存,助攻,物理,魔法,防御,金钱)

getAbilityRatio(sys.argv[1])